package com.wudgaby.study.jwtauth.util;

import org.springframework.util.Assert;

import java.util.Arrays;
import java.util.StringJoiner;

/**
 * @ClassName : RedisKeyUtil
 * @Author :  WudGaby
 * @Version :  1.0
 * @Date : 2018/10/5/005 16:21
 * @Desc :   TODO
 */
public class RedisKeyUtil {
    private RedisKeyUtil(){
        throw new UnsupportedOperationException();
    }
    private static final String REDIS_SPLIT = ":";

    public static String buildKey(String... keys) {
        Assert.notEmpty(keys, "至少输入一个key");

        StringJoiner stringJoiner = new StringJoiner(REDIS_SPLIT);
        Arrays.asList(keys).forEach(key -> stringJoiner.add(key));
        //stringJoiner.add("");
        return stringJoiner.toString();
    }
}
